package com.xuecheng.api.client.fallback;

import com.xuecheng.api.client.LearningClient;
import com.xuecheng.api.dto.XcCourseTablesDTO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author 勾新杰
 * @version 1.0
 * @description:
 * @date 2025/3/15 10:23
 */
@Slf4j
public class LearningClientFallBackFactory implements FallbackFactory<LearningClient> {
    @Override
    public LearningClient create(Throwable throwable) {
        return new LearningClient() {
            @Override
            public List<XcCourseTablesDTO> getCourseTables(String userId) {
                log.error("远程调用学习服务熔断异常：{}", throwable.getMessage());
                return null;
            }
        };
    }
}
